<template>
  <div>
    <UploadExcel :on-success="onSuccess" />
  </div>
</template>

<script>
import UploadExcel from '@/components/lib/Uploexecle/index.vue'

export default {
  name: 'Index2',
  components: { UploadExcel },
  methods: {
    // 上传前做处理 ，文件类型，文件大小
    // 写就要返回一个布尔值，tuer通过
    beforeUpload(res) {
      const pp = /\.(xlsx|xls|csv)$/.test(res.name)
      const dx = res.size % 1024 % 1024 < 2

      return pp && dx
    },

    // 上传后拿到数据干什么
    onSuccess(res) {
      console.log(res)
    }
  }

}
</script>

<style>

</style>
